FROM node:20

RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list
RUN apt-get -qq update && \
    apt-get install -y \
    gcc \
    python3 \
    g++ \
    fp-compiler \
    openjdk-17-jdk-headless \
    libjavascriptcoregtk-4.0-bin
RUN mkdir -pv /root/.hydro
ADD ./entrypoint.sh /root/entrypoint.sh
ADD ./judge.yaml /root/.hydro/judge.yaml
RUN chmod +x /root/entrypoint.sh

RUN yarn config set npmRegistryServer  https://registry.npmmirror.com
RUN yarn global add pm2 @hydrooj/hydrojudge

RUN wget https://ghproxy.cc/https://github.com/criyle/go-judge/releases/download/v1.8.0/go-judge_1.8.0_linux_amd64 -O /usr/bin/sandbox && \
    chmod +x /usr/bin/sandbox

ENTRYPOINT /root/entrypoint.sh
